package com.yangjun.common;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import static springfox.documentation.builders.PathSelectors.regex;
@Configuration
@EnableSwagger2
public class Swagger2Configuration {
	@Bean
	public Docket accessToken(){
		return new Docket(DocumentationType.SWAGGER_2)
				.groupName("api")
				.select()
				.apis(RequestHandlerSelectors.basePackage("com.yangjun.controller"))
				.paths(regex("/api/.*"))
				.build()
				.apiInfo(apiInfo());
	}
	
	private ApiInfo apiInfo(){
		return new ApiInfoBuilder()
				.title("数据平台")
				.description("数据产品接口调试")
				.termsOfServiceUrl("")
				.contact(new Contact("杨俊","","125960563@qq.com"))
				.version("1.0")
				.build();
	}
}
